Skip to content

Add accessibility-backed text manipulation#968

Open
jamilahmadzai wants to merge 1 commit into
dictation-toolbox:masterfrom
jamilahmadzai:accessibility-text-814
Open

Add accessibility-backed text manipulation#968
jamilahmadzai wants to merge 1 commit into
dictation-toolbox:masterfrom
jamilahmadzai:accessibility-text-814

Conversation

@jamilahmadzai
Copy link
Copy Markdown

@jamilahmadzai jamilahmadzai commented May 29, 2026

Description

Adds an optional Dragonfly accessibility path for the existing Caster text manipulation commands.

When Dragonfly exposes focused editable text through its accessibility controller, Caster now uses that focused text range for:

  • grab / select phrase
  • grab ... until ...
  • go / move to a phrase boundary
  • replace ... with ...
  • remove phrase
  • remove ... until ...
  • capitalization changes that replace the matched phrase

The existing clipboard-based behavior remains the fallback when accessibility is unavailable, the focused control is not editable, or the requested phrase cannot be found through accessibility.

Related Issue

Refs #814

Approach overview posted in the issue: #814 (comment)

Motivation and Context

Issue #814 asks for Select-and-Say-style text navigation through OS accessibility APIs. The issue discussion points toward using Dragonfly's existing accessibility controller rather than adding a separate Caster-specific backend or a new dependency.

This PR keeps the change scoped to Caster's current text manipulation commands. It uses Dragonfly's focused editable text when available, handles Caster's existing left/right/up/down search-window semantics, treats CRLF and Dragonfly text-node delimiters as boundaries, and avoids clipboard selection/copy when the accessibility path succeeds.

How Has This Been Tested

Local environment: Python 3.10 via uv on macOS.

  • python -m unittest tests.lib.test_text_manipulation_accessibility -v
    • 10 tests passed
  • python tests/testrunner.py
    • 127 tests passed
  • python -m py_compile castervoice/rules/core/text_manipulation_rules/accessibility_text.py castervoice/rules/core/text_manipulation_rules/text_manipulation_support.py tests/lib/test_text_manipulation_accessibility.py
  • pylint -E castervoice/rules/core/text_manipulation_rules/accessibility_text.py castervoice/rules/core/text_manipulation_rules/text_manipulation_support.py
  • git diff --check

The added tests use fake focused accessibility text objects to validate range selection, cursor movement, replacement/deletion actions, CRLF boundaries, Dragonfly text-node delimiters, non-editable fallback, and that successful accessibility handling returns before the clipboard fallback path.

This does not add or validate a new OS accessibility backend; it is the Caster-side integration against Dragonfly's existing controller surface.

Bounty / payout

IssueHunt payout: @jamilahmadzai

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue or bug)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Renamed existing command phrases (we discourage this without a strong rationale).

Checklist

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • I have checked that my code does not duplicate functionality elsewhere in Caster.
  • I have checked for and utilized existing command phrases from within Caster (delete if not applicable).
  • My code implements all the features I wish to merge in this pull request.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests pass.

Maintainer/Reviewer Checklist

  • Basic functionality has been tested and works as claimed.
  • New documentation is clear and complete.
  • Code is clear and readable.

IssueHunt Summary

Referenced issues

This pull request has been submitted to:


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant